﻿// -----------------------------------------------------------------------
// <copyright file="PapRoot.cs" company="Zen Design Corp">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Zen.BlackBerry.Pap
{
	using System.Xml.Serialization;
	using Zen.BlackBerry.Pap.Control;
	using Zen.BlackBerry.Pap.Parser;

	/// <summary>
	/// Represents the root element of a PAP XML message.
	/// </summary>
	[XmlRoot(ElementName = "pap")]
	public class PapRoot
	{
		/// <summary>
		/// Gets or sets the name of the product.
		/// </summary>
		/// <value>The name of the product.</value>
		[XmlAttribute(AttributeName = "product-name")]
		public string ProductName
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the request.
		/// </summary>
		/// <value>The request.</value>
		[XmlElement(ElementName = "cancel-message", Type = typeof(CancelMessageControl))]
		[XmlElement(ElementName = "push-message", Type = typeof(PushMessageControl))]
		[XmlElement(ElementName = "resultnotification-response", Type = typeof(ResultNotificationResponseControl))]
		[XmlElement(ElementName = "statusquery-message", Type = typeof(StatusQueryMessageControl))]
		public PapControl Request
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the response.
		/// </summary>
		/// <value>The response.</value>
		[XmlElement(ElementName = "badmessage-response", Type = typeof(BadMessageResponse))]
		[XmlElement(ElementName = "cancel-response", Type = typeof(CancelResponse))]
		[XmlElement(ElementName = "push-response", Type = typeof(PushResponse))]
		[XmlElement(ElementName = "resultnotification-message", Type = typeof(ResultNotification))]
		[XmlElement(ElementName = "statusquery-result", Type = typeof(StatusQueryResponse))]
		public PapMessage Response
		{
			get;
			set;
		}
	}
}
